<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->plugin_setting('setting',$postdata);
		exi('设置成功');
	}
	$footernav =array(
		array('title'=>'首页','icon'=>'icon-shouye','action'=>'jy_area_dai/index/'),
		array('title'=>'客服','icon'=>'icon-kefu','action'=>'jy_kefu/home/'),
		array('title'=>'订单','icon'=>'icon-manageorder','action'=>'jy_area_dai/myorder/'),
		array('title'=>'我的','icon'=>'icon-wo1','action'=>'jy_area_dai/myhome/'),
	);
	$fenfooternav =array(
		array('title'=>'首页','icon'=>'icon-dianpu','action'=>'jy_area_dai/index/'),
		array('title'=>'经销商','icon'=>'icon-wo1','action'=>'jy_area_dai/agent/'),
		array('title'=>'佣金','icon'=>'icon-yiban','action'=>'jy_area_dai/commission/'),
		array('title'=>'销售','icon'=>'icon-dingdan','action'=>'jy_area_dai/order.list/'),
		array('title'=>'下线','icon'=>'icon-paihao0','action'=>'jy_area_dai/down/'),
		array('title'=>'商品','icon'=>'icon-viewlist','action'=>'jy_area_dai/mygoods/'),
	);
	$yefooternav =array(
		array('title'=>'首页','icon'=>'icon-dianpu','action'=>'jy_area_dai/index/'),
		array('title'=>'业务员','icon'=>'icon-wo1','action'=>'jy_area_dai/yewu/'),
		array('title'=>'佣金','icon'=>'icon-yiban','action'=>'jy_area_dai/commission/'),
		array('title'=>'销售','icon'=>'icon-dingdan','action'=>'jy_area_dai/order.list/'),
		array('title'=>'下线','icon'=>'icon-paihao0','action'=>'jy_area_dai/down/'),
	);
	$hdps =array(
		array('title'=>'首页','picurl'=>'../addons/jy_weishop/resource/images/mobile-hdp01.jpg','action'=>'index/'),
		array('title'=>'全部','picurl'=>'../addons/jy_weishop/resource/images/mobile-hdp02.jpg','action'=>'allplugins/'),
	);
	$bankuai1 =array(
		array('title'=>'新品上线','img'=>'../addons/jy_weishop/resource/images/new_icon.png','action'=>'jy_area_dai/index//order=new'),
		array('title'=>'新人专享','img'=>'../addons/jy_weishop/resource/images/sale_new.png','action'=>'jy_area_dai/index//order=sale_new'),
	);
	$bankuai2 =array(
		array('title'=>'店主专享','img'=>'../addons/jy_weishop/resource/images/new_icon.png','action'=>'jy_area_dai/index//order=new'),
		array('title'=>'店主特卖','img'=>'../addons/jy_weishop/resource/images/sale_new.png','action'=>'jy_area_dai/index//order=sale_new'),
	);
	$return['item']=$this->plugin_setting('setting');
	$return['item']['bankuai1'] = !empty($return['item']['bankuai1']) ? $return['item']['bankuai1'] : $bankuai1;
	$return['item']['demobankuai1'] = $bankuai1;
	$return['item']['bankuai2'] = !empty($return['item']['bankuai2']) ? $return['item']['bankuai2'] : $bankuai2;
	$return['item']['demobankuai2'] = $bankuai2;
	$return['item']['hdps']=$return['item']['hdps']?:$hdps;
	$return['item']['footernav']=$return['item']['footernav']?:$footernav;
	$return['item']['fenfooternav']=$return['item']['fenfooternav']?:$fenfooternav;
	$return['item']['yefooternav']=$return['item']['yefooternav']?:$yefooternav;
	$commissions=array();
	$commissions[]=array('name'=>'num','title'=>'下线人数','type'=>'unitstring','unit'=>'人');
	$commissions[]=array('name'=>'fee','title'=>'奖励现金','type'=>'unitstring','unit'=>'元');
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'tabs'=>$tabs,
		'edit_tab'=>true,
		'edits'=>array(
			array(
				'title'=>'基础设置',
				'list'=>array(
					array('type'=>'switch','title'=>'开启经销模式','name'=>'isopen'),
					array('type'=>'string','title'=>'商城名称','name'=>'title'),
					//array('type'=>'radio','title'=>'经销层级','name'=>'level','options'=>'level'),
					array('name'=>'adminmid','title'=>'选择管理员','type'=>'choose','action'=>'core/member.get_member/','help'=>'接收审核店主消息通知'),
					array('type'=>'string','title'=>'分享标题','name'=>'share_title'),
					array('type'=>'image','title'=>'分享图片','name'=>'share_image'),
					array('type'=>'string','title'=>'分享描述','name'=>'share_desc'),
					//array('type'=>'link','from'=>'action','title'=>'分享/二维码跳转链接','name'=>'share_link','help'=>'默认跳转到小店，指定链接后，跳转到指定页面！'),

				)
			),
			array(
				'title'=>'上下线关系及经销资格',
				'list'=>array(
					array('type'=>'radio','title'=>'成为下线条件','name'=>'become_child','options'=>'become_child'),
					array('type'=>'radio','title'=>'成为经销商条件','name'=>'become','options'=>'become','help'=>'如果是无条件，将自动成为经销商！无需填写申请！'),
					array('type'=>'choose_many','name'=>'become_goods','title'=>'购买商品成为经销商','show'=>array('become'=>4),'action'=>'jy_weishop/goods.get_goods/many/','choose_title'=>'选择参与的商品'),
					array('type'=>'string','title'=>'消费次数达到（次）','name'=>'num','show'=>array('become'=>2)),
					array('type'=>'string','title'=>'消费金额达到（元）','name'=>'money','show'=>array('become'=>3)),
					array('type'=>'radio','title'=>'经销商是否需要审核','name'=>'become_check','options'=>'is'),
					array('type'=>'switch','title'=>'上级可审核下级？','name'=>'agent_check','show'=>array('become_check'=>1)),
					array('type'=>'radio','title'=>'经销商必须完善资料','name'=>'become_reg','options'=>'is'),
					array('type'=>'switch','title'=>'是否需手动选择身份等级？','name'=>'is_checklevel'),
				)
			),
			array(
				'title'=>'结算',
				'list'=>array(
					//array('type'=>'radio','title'=>'佣金奖励方式','name'=>'send_feetype','options'=>'send_feetype','help'=>'如果是经销商奖励，所有奖励又经销商审核发放！'),
					//array('type'=>'radio','title'=>'补充金奖励方式','name'=>'send_bufeetype','options'=>'send_feetype','help'=>'如果是经销商奖励，经销商需充值奖金池！'),
					array('type'=>'checkbox','title'=>'支持的提现方式','name'=>'withdrawtype','options'=>'withdraw'),
					array('type'=>'string','title'=>'结算额度（元）','name'=>'balance_money','help'=>'佣金达到该数值才能结算'),
					array('type'=>'string','title'=>'佣金打款手续费（%）','name'=>'balance_per'),
					array('type'=>'radio','title'=>'佣金计算方式','name'=>'commissiontype','options'=>'commissiontype','help'=>''),
					array('type'=>'string','title'=>'免手续费提现区间开始金额','name'=>'balance_money_start'),
					array('type'=>'string','title'=>'免手续费提现区间结束金额','name'=>'balance_money_end','help'=>'当提现手续费金额在此区间内时,不扣除提现手续费. 结束金额 必须大于 开始金额才能生效'),
					array('type'=>'string','title'=>'结算天数','name'=>'balance_day','help'=>'当订单完成后的n天后，佣金才能申请提现,设置0或空，订单完成就可以结算'),
				),
			),
			array(
					'title'=>'(月度)优秀店主极差分红',
					'list'=>array(
						array('type'=>'switch','title'=>'(月度)优秀店主极差分红?','name'=>'yuered_open'),
						array('type'=>'array','(月度)分红阶梯','name'=>'yueji_fee','add_tip'=>'添加一个分红阶梯',
								'list'=>array(
									array('type'=>'string','name'=>'manfee','title'=>'满多少额度'),	
									array('type'=>'string','name'=>'rate','title'=>'分红比率'),
								),
								'details'=>array(
									array('type'=>'string','name'=>'manfee','title'=>'满多少额度'),	
									array('type'=>'string','name'=>'rate','title'=>'分红比率'),
								)
						),
					)
			),
			array(
				'title'=>'排行榜(奖金池)设置',
				'list'=>array(
						array('type'=>'switch','name'=>'open_feechi','title'=>'开启排行榜(奖金池)','help'=>'开启后，按比例进入排行榜奖金池！'),
						array('type'=>'unitstring','unit'=>'人','name'=>'month_num','title'=>'月度奖励前几名？'),
						array('type'=>'unitstring','unit'=>'%','name'=>'month_rate','title'=>'月度奖励比例'),
						array('type'=>'unitstring','unit'=>'元','name'=>'month_fee','title'=>'月度奖金池满额发奖？'),
						array('type'=>'unitstring','unit'=>'人','name'=>'year_num','title'=>'年度奖励前几名？'),
						array('type'=>'unitstring','unit'=>'%','name'=>'year_rate','title'=>'年度奖励比例'),
						array('type'=>'unitstring','unit'=>'元','name'=>'year_fee','title'=>'年度奖金池满额发奖？'),
					)
			),
			array(
				'title'=>'经销商等级升级',
				'list'=>array(
						array('type'=>'checkbox','title'=>'经销商升级依据','name'=>'level_up_types','options'=>'leveltype','help'=>'开启《指定购买商品》后，可以在经销等级设置不同的商品！'),		
						array('type'=>'switch','name'=>'is_leveltime','title'=>'开启有效期','help'=>'开启后，可设置到期时间，到期后会降级。默认降为下一级，经销等级，可以指定降为哪一级！'),
						array('type'=>'unitstring','unit'=>'天','name'=>'leveltime','title'=>'有效期时长（如果经销等级指定商品升级，多次购买会叠加延期）'),
					)
			),
			array(
					'title'=>'幻灯片',
					'list'=>array(
						array('type'=>'array','name'=>'hdps','add_tip'=>'添加一个幻灯片',
								'list'=>array(
									array('type'=>'image','name'=>'picurl','title'=>'图片'),	
									array('type'=>'string','name'=>'url','title'=>'地址'),
								),
								'details'=>array(
									array('type'=>'image','name'=>'picurl','title'=>'图片','help'=>'推荐尺寸：750*240'),
									array('type'=>'link','name'=>'url','from'=>'action','title'=>'地址'),
								)
						),
					)
			),
			array(
							'title'=>'公共板块',
							'list'=>array(
									array('type'=>'updemo','name'=>'bankuai1','demo'=>'demobankuai1','title'=>'重置导航','help'=>'不知道添加什么导航？重置默认的一下试试！'),
									array('type'=>'array','name'=>'bankuai1','add_tip'=>'添加一个板块导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'image','name'=>'img','title'=>'导航图片'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'image','name'=>'img','title'=>'导航图片'),							
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
								),
							)
			),
			array(
							'title'=>'店主显示板块',
							'list'=>array(
									array('type'=>'updemo','name'=>'bankuai2','demo'=>'demobankuai2','title'=>'重置导航','help'=>'不知道添加什么导航？重置默认的一下试试！'),
									array('type'=>'array','name'=>'bankuai2','add_tip'=>'添加一个板块导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'image','name'=>'img','title'=>'导航图片'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'image','name'=>'img','title'=>'导航图片'),							
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
								),
							)
			),
			array(
				'title'=>'底部导航',
					'list'=>array(
									array('type'=>'array','name'=>'footernav','add_tip'=>'添加一个底部导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标','help'=>'图标，例如：icon-shouye'),							
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
								),
					)
			),
			/*array(
				'title'=>'经销商底部导航',
					'list'=>array(
									array('type'=>'array','name'=>'fenfooternav','add_tip'=>'添加一个底部导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标','help'=>'图标，例如：icon-shouye'),							
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
								),
					)
			),
			array(
				'title'=>'业务员底部导航',
					'list'=>array(
									array('type'=>'array','name'=>'yefooternav','add_tip'=>'添加一个底部导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标','help'=>'图标，例如：icon-shouye'),							
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
								),
					)
			),*/
		)
	);
	$return['levels']=$this->getall('level',array('uniacid'=>$_SESSION['uniacid']),array('id','title'),'id');
	$return['levels']['0']=array('id'=>0,'title'=>'默认等级');
	$return['commissiontypes']=$this->commission_types2;
	$return['leveltype']=$this->level_up_types;
	$return['otherfee_types']=$this->model('model')->otherfee_types();
	$return['withdraw']=$this->pay_types;
	$return['commissiontype']=$this->commission_types;
	$return['send_feetype']=$this->send_feetype;
	$return['is']=array('0'=>'否','1'=>'是');
	$return['become_child']=array('1'=>'首次点击链接','2'=>'首次下单','3'=>'首次付款');
	$return['become']=array('0'=>'无条件','1'=>'申请','2'=>'消费次数','3'=>'消费金额','4'=>'购买商品');
	$return['showgetfee']=array('0'=>'不显示','1'=>'全部可见','2'=>'仅代理商可见');
	$return['level']=$this->level_types;
	$return['gift_type']=$this->gift_type;
	$return['htmls']=$htmls;
	exi($return);
}


